package la.iok.hzsvn.lewin.movie.service;

import la.iok.hzsvn.lewin.movie.entity.PlayRoleBook;
import la.iok.hzsvn.lewin.movie.entity.PlayRoleBookImage;
import la.iok.hzsvn.lewin.movie.entity.PlayRoleBookInstance;
import la.iok.hzsvn.lewin.movie.model.PlayRoleBookVo;
import la.iok.hzsvn.lewin.mybatis.service.BaseService;
import la.iok.hzsvn.share.annotations.NotNull;
import la.iok.hzsvn.share.annotations.NotNullElement;
import la.iok.hzsvn.share.annotations.NullElement;
import la.iok.hzsvn.share.annotations.Nullable;

import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.List;

public interface PlayRoleBookInstanceService extends BaseService<PlayRoleBookInstance, Long> {
    @NotNull
    Long save(@NotNull PlayRoleBook book,@NotNull Long playRoleInstanceId,@NotNull Long chapterInstanceId,
              @NotNull Long htmlId, @NotNull String htmlPath);

    /**
     * 根据指定的电子收查询最近的实例对象。根据文件id查找
     * @param books 电子书列表
     * @return 最近的电子书实例列表
     */
    @NotNull
    @NotNullElement
    List<PlayRoleBookInstance> nearest(@NotNull @NotNullElement List<PlayRoleBook> books);

    @Nullable
    PlayRoleBookInstance find(@Nullable Iterable<PlayRoleBookInstance> iterable, @Nullable Long fileId);

    @NotNull
    @NotNullElement
    List<PlayRoleBookVo> books(@Nullable Long movieInstanceId);

    @Nullable
    String digest(@Nullable Long movieInstanceId, @Nullable Long playRoleBookId);

    @Nullable
    String storePath(@Nullable Long movieInstanceId, @Nullable Long playRoleBookId);

    void downloadFile(HttpServletResponse response, @Nullable Long movieInstanceId, @Nullable Long playRoleBookId);

    @NotNull
    @NotNullElement
    List<PlayRoleBookImage> images(@Nullable Long movieInstanceId, @Nullable Long playRoleBookId);

    /**
     * 标记文件已删除
     * @param ids id集合
     */
    void markFileDeleted(@Nullable @NullElement Collection<Long> ids);
}
